<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="org.jeecgframework.web.util.StaticValue" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title>发货单信息</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
    <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css"/>
    <style>
        .window-shadow {
            display: none !important;
        }

        #menu {
            width: 0; /*设置为0 隐藏自定义菜单*/
            height: 125px;
            overflow: hidden; /*隐藏溢出的元素*/
            box-shadow: 0 1px 1px #888, 1px 0 1px #ccc;
            position: absolute; /*自定义菜单相对与body元素进行定位*/
        }

        .menu {
            width: 130px;
            height: 25px;
            line-height: 25px;
            padding: 0 10px;
        }
    </style>
    <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
    <script type="text/javascript">
        //编写自定义JS代码
        $(document).ready(function () {
            getSLAByWarsoue();
            // getSLA();
            /*
            * 根据是否自提显示隐藏自提仓库
            * */
            var isZt = $('#isZt').text();
            //alert(isZt)
            if (isZt == '是') {
                $('#ztCk').show();
                // $('#shAddress').hide();
                // $('#shUser').hide();
            } else {
                $('#ztCk').hide();
                // $('#shAddress').show();
                // $('#shUser').show();
            }

        })

        /**比较日期 **/
        function CompareDate(d1, d2) {
            return ((new Date(d1.replace(/-/g, "\/"))) > (new Date(d2.replace(/-/g, "\/"))));
        }


        $(function () {
            var cbsDeliverId = $("#id").val();
            $("#uploadFile").uploadify({
                buttonText: '上传文件',
                auto: true,
                progressData: 'speed',
                multi: true,
                height: 20,
                width: 60,
                overrideEvents: ['onDialogClose'],
                queueID: 'instructionfile',
                /*fileTypeDesc : '文件格式:',
                fileTypeExts : '*.*',*/
                fileTypeDesc: '支持格式:*',
                fileTypeExts: '*', //控制可上传文件的扩展名，启用本项时需同时声明fileDesc
                fileSizeLimit: '50MB',
                swf: 'plug-in/uploadify/uploadify.swf',
                uploader: '<%=basePath%>/cbsDelinerController.do?uploadFile&cbsDeliverId=' + cbsDeliverId + '&sessionId=' + $("#sessionId").val() + '',
                onUploadStart:function(){
                    lockmask(true,'请稍等,导入中...');
                },onUploadSuccess: function (file, data) {
                    lockmask(false);
                    var json = $.parseJSON(data).attributes;
                    var fileIds = $("#fileId").val();
                    $("#repairFrontFile").val(json.id);
                    var html = '<span id="li_file_' + json.id + '"><span class="color-blue" id="' + json.id + '">' + json.name + '</span>&nbsp;&nbsp; ' +
                        '<span style="cursor: pointer;" onclick=\'delFile("' + json.id + '")\'>[删除]</span></span>'
                    $("#fileName").prepend(html);
                }, onFallback: function () {
                    parent.window.tip("您未安装FLASH控件，无法上传文件！请安装FLASH控件后再试");
                }, onSelectError: function (file, errorCode, errorMsg) {
                    switch (errorCode) {
                        case -100:
                            parent.window.tip("上传的文件数量已经超出系统限制的" + $('#instruction').uploadify('settings', 'queueSizeLimit') + "个文件！");
                            break;
                        case -110:
                            parent.window.tip("文件 [" + file.name + "] 大小超出系统限制的50MB大小！");break;
                        case -120:
                            parent.window.tip("文件 [" + file.name + "] 大小异常！");
                            break;
                        case -130:
                            parent.window.tip("文件 [" + file.name + "] 类型不正确！");
                            break;
                    }
                    ;
                }
            });
        })

        function getTree(obj, id) {
            var uuid = obj.id;
            //alert("uuid:"+uuid)
            $.dialog({
                content: "url:cbsDelinerController.do?goChooseEquipmentType&uuid=" + uuid + "&id=" + id,
                zIndex: 2100,
                title: '机型',
                lock: true,
                width: '300px',
                height: '400px',
                left: '55%',
                top: '65%',
                opacity: 0.4,
                init: function () {
                    top.myWindow = window;
                },
            });
        }

        function getCity() {
            var province = $("#thProvince").val();
            $.ajax({
                type: "post",
                dataType: "json",
                data: {"province": province},
                url: "cbsDelinerController.do?getCityBySheng",
                success: function (data) {
                    var obj = data.obj;
                    var html = " <option>--请选择城市--</option>";
                    for (i in obj) {
                        html += "<option value='" + obj[i].id + "'>" + obj[i].territoryName + "</option>";
                    }
                    $('#thShi').html(html)
                }
            })
        }

        function getCang() {

            var cityId = $("#city").val();
            var logistics = $("#deliverLogistics_id").val();
            $.ajax({
                type: "GET",
                data: {"cityCode": cityId, "logistics": logistics},
                url: "cbsDelinerController.do?getWarehouseByLogistics",
                dataType: "json",
                success: function (data) {
                    var obj = data.obj;
                    var html = "<option value='0'>--请选择仓库--</option>";
                    for (i in obj) {
                        html += "<option value='" + obj[i].id + "'>" + obj[i].name + "</option>";
                    }
                    $("#deliverWarehouseId").html(html);
                    getWarehouseContacts();
                }
            })
        }

        function getWarehouseByLogistics() {

            var city = $("#city").val();
            var logistics = $("#deliverLogistics_id").val();
            if (logistics == "0") {
                getCang();
            } else {
                $.ajax({
                    type: "GET",
                    data: {"cityCode": city, "logistics": logistics},
                    url: "cbsDelinerController.do?getWarehouseByLogistics",
                    dataType: "json",
                    success: function (data) {
                        var tbs = data.obj;

                        if (tbs == null) {
                            $("#deliverWarehouseId").html("<option value=''>--请选择仓库--</option>");
                            $("#warehouseContacts").html('暂无联系人');
                        } else {
                            var html = "<option value='0'>--请选择仓库--</option>";
                            for (i in tbs) {
                                html += "<option value='" + tbs[i].id + "'>" + tbs[i].name + "</option>";

                            }
                            $("#deliverWarehouseId").html(html);
                            var cityId = $("#city").val();
                            if (cityId != "") {
                                $.ajax({
                                    type: "GET",
                                    data: {"cityCode": cityId, "logistics": logistics},
                                    url: "cbsDelinerController.do?getWarehouseByLogisticsForCity",
                                    dataType: "json",
                                    success: function (data) {
                                        var obj = data.obj;
                                        $('#deliverWarehouseId option').each(function () {
                                            if ($(this).val() == obj[0].id) {
                                                $(this).attr("selected", true);
                                            }
                                        })
                                        getWarehouseContacts();
                                    }
                                })
                            }
                        }
                        getWarehouseContacts();
                    }
                })
            }

        }
        
        /*
       * 获取仓库联系人
       * */
        function getWarehouseContacts() {

            var deliverWarehouseId = $("#deliverWarehouseId").val();
            // alert(deliverWarehouseId)
            if (deliverWarehouseId == "0") {
                $("#warehouseContacts").html('<label>暂无联系人信息</label>');
            } else {
                $.ajax({
                    type: "GET",
                    data: {"code": deliverWarehouseId},
                    url: "cbsDelinerController.do?getWarehouseContacts",
                    dataType: "json",
                    success: function (data) {
                        var tbs = data.obj;
                        var name = tbs.userName;
                        var phone = tbs.phone;
                        var email = tbs.email;

                        if (tbs.userName == null) {
                            name = "";
                        }
                        if (tbs.phone == null) {
                            phone == "";
                        }
                        if (tbs.email == null) {
                            email == "";
                        }
                        if (tbs.email == null && tbs.userName == null && tbs.phone == null) {
                            html = '<label>暂无联系人信息</label>';
                        } else {
                            html = '<label>' + name + '&nbsp &nbsp ' + phone + '&nbsp &nbsp' + email + '</label>';
                        }
                        $("#warehouseContacts").html(html);
                        console.log("contects:" + tbs)
                    }

                })
            }

        }

        function getFhContacts() {
            var logisticsName = $("#deliverLogistics_id").val();
            //alert(logisticsName)
            $.ajax({
                type: "GET",
                data: {"code": logisticsName},
                url: "cbsDelinerController.do?getContacts",
                dataType: "json",
                success: function (data) {
                    var tbs = data.obj;
                    //alert("tbs:"+tbs);
                    if (tbs == null || tbs == "") {
                        //alert("暂无联系人信息");
                        $('#contactsName').text("暂无联系人信息")
                        $('#contactsPhone').text("暂无联系人信息")
                        $('#contactsEmail').text("暂无联系人信息")
                    } else {
                        $('#contactsName').text(tbs.name)
                        $('#contactsPhone').text(tbs.cellphone1)
                        $('#contactsEmail').text(tbs.email)
                    }
                }
            })
        }

        function getReturnContacts() {
            var logisticsName = $("#returnLogistics").val();
            //alert(logisticsName)
            $.ajax({
                type: "GET",
                data: {"code": logisticsName},
                url: "cbsDelinerController.do?getContacts",
                dataType: "json",
                success: function (data) {
                    var tbs = data.obj;
                    //alert("tbs:"+tbs);
                    if (tbs == null || tbs == "") {
                        //alert("暂无联系人信息");
                        $('#returnName').text("暂无联系人信息")
                        $('#returnPhone').text("暂无联系人信息")
                        $('#returnEmail').text("暂无联系人信息")
                    } else {
                        $('#returnName').text(tbs.name)
                        $('#returnPhone').text(tbs.cellphone1)
                        $('#returnEmail').text(tbs.email)
                    }
                }
            })
        }


        function doUpdate() {

            var deliverStatus = $('#deliverStatus').text();
            var deliverid = $('#deliverId').val();
            var deliverType = $('#deliverType').val();
            var soCode = $('#soCodeId').val();
            var srCode = $('#SRCode').val();
            var fhSLA = $('#fhSLA').val();
            var thProvince = $('#thProvince').val();
            var deliverLogistics = $('#deliverLogistics_id').val();
            var fhSLA = $('#fhSLA').val();
            var thProvince = $('#thProvince').val();
            var thShi = $('#thShi').val();
            var thAddress = $('#thAddress').val();
            var deliverWarehouse = $('#deliverWarehouseId').val();
            var kuwei = $('#kuwei').val();
            var expectTime = $('#expectTime').val();
            var deliverMemo = $('#deliverMemo').val();
            var logisticsMemo = $('#logisticsMemo').val();
            var csaAttention = $('#csaAttention').val();
            var returnLogistics = $('#returnLogistics').val()
            var WlSx = $('#WlSx').text();

            //tab名
            var dCode = $('#code').text();
            var tabName = "编辑" + dCode;

            if(deliverType==null || deliverType==''){
                $('#deliverTypeErr').show();
                parent.window.tip("请选择发货单类型")
                return false;
            }

            var equipment = [];
            var typeNull = true;
            var itemNull = true;
            $('#updateEquipment table').each(function () {
                var obj = {};

                obj.deliverEquipmentId = $(this).find('input[name="deliverEquipmentId"]').val();
                obj.applyLayer = $(this).find('select[name="applyLayer"] option:selected').val();
                obj.applyReason = $(this).find('select[name="applyReason"] option:selected').val();
                obj.equipmentType = $(this).find('input[name="equipmentTypeId"]').val();
                obj.equipmentTypeDes = $(this).find('input[name="equipmentType"]').val();
                obj.item = $(this).find('input[name="item"]').val();
                obj.itemId = $(this).find('select[name="equipmentItem"] option:selected').val();
                obj.isReturn = $(this).find('select[name="isReturn"] option:selected').val();
                obj.sn = $(this).find('input[name="sn"]').val();
                obj.memo = $(this).find('textarea[name="memo"]').val();
                equipment.push(obj)
                console.log(obj);
                //alert("obj:"+equipment);
                var eqid = obj.deliverEquipmentId
                if (obj.equipmentTypeDes == null || obj.equipmentTypeDes == '') {
                    $('#' + eqid + 'typeDesErr').show()
                    typeNull = false;
                }

                if (obj.itemId == null || obj.itemId == '') {
                    if (obj.item == null || obj.item == '') {
                        $('#' + eqid + 'itemIdErr').show()
                        itemNull = false;
                    }
                }
            });

            if (typeNull == false) {
                parent.window.tip("请选择备件类型")
                return false;
            }
            if (itemNull == false) {
                parent.window.tip("请填写备件号")
                return false;
            }

            //判断是否需要返件
            var isr = false;
            for (var i = 0; i < equipment.length; i++) {
                console.log("r:" + equipment[i].isReturn);
                if (equipment[i].isReturn == 2) {
                    isr = true;
                }
            }

            if (deliverLogistics == "" || deliverLogistics == "0") {
                $('#deliverLogistics_idErr').show()
                parent.window.tip("请选择发货物流")
                return false;
            }
            if (deliverWarehouse == "" || deliverWarehouse == "0") {
                $('#deliverWarehouseIdErr').show()
                parent.window.tip("请选择仓库")
                return false;
            }

            //如果需要返件，返件物流为必填项
            if (isr) {
                if (returnLogistics == null || returnLogistics == '' || returnLogistics == '0') {
                    $('#retrun_logisticsErr').show()
                    parent.window.tip("请选择返件物流")
                    return false;
                }
            } else {
                $('#retrun_logisticsErr').hide()
            }
            jQuery.messager.confirm('确认信息', '确定要更改发货单吗?', function (event) {
                if (event) {
                    $.ajax({
                        type: "POST",
                        data: {
                            'deliverLogistics_id': deliverLogistics,
                            'fhSLA': fhSLA,
                            'thProvince': thProvince,
                            'thShi': thShi,
                            'thAddress': thAddress,
                            'deliverWarehouse': deliverWarehouse,
                            'kuwei': kuwei,
                            'returnLogistics': returnLogistics,
                            'expectTime': expectTime,
                            'csaAttention': csaAttention,
                            'logisticsMemo': logisticsMemo,
                            'deliverMemo': deliverMemo,
                            'deliverStatus': deliverStatus,
                            'WlSx': WlSx,
                            'deliverType': deliverType,
                            'deliverid': deliverid,
                            'soCode': soCode,
                            'srCode': srCode,
                            'equipment': JSON.stringify(equipment)
                        },
                        url: "cbsDelinerController.do?doUpdate",
                        dataType: "json",
                        success: function (data) {
                            //alert("data:"+data);
                            parent.window.tip("更改成功");

                            setTimeout("addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                            setTimeout("closetab('" + tabName + "')", 1000);
                        }
                    })
                } else {
                    // alert("你点击的是false");
                }
            });
        }

        function sendCF() {
            var deliverStatus = $('#deliverStatus').text();
            var deliverid = $('#deliverId').val();
            var deliverType = $('#deliverType').val();
            var soCode = $('#soCodeId').val();
            var srCode = $('#SRCode').val();
            var fhSLA = $('#fhSLA').val();
            var thProvince = $('#thProvince').val();
            var thShi = $('#thShi').val();
            var deliverLogistics = $('#deliverLogistics_id').val();
            var fhSLA = $('#fhSLA').val();
            var thProvince = $('#thProvince').val();
            var thShi = $('#thShi').val();
            var thAddress = $('#thAddress').val();
            var deliverWarehouse = $('#deliverWarehouseId').val();
            var kuwei = $('#kuwei').val();
            var expectTime = $('#expectTime').val();
            var deliverMemo = $('#deliverMemo').val();
            var logisticsMemo = $('#logisticsMemo').val();
            var csaAttention = $('#csaAttention').val();
            var returnLogistics = $('#returnLogistics').val();
            //tab名
            var dCode = $('#code').text();
            var WlSx = $('#WlSx').text();
            var tabName = "编辑" + dCode;

            if(deliverType==null || deliverType==''){
                $('#deliverTypeErr').show();
                parent.window.tip("请选择发货单类型")
                return false;
            }

            var equipment = [];
            var typeNull = true;
            var itemNull = true;
            $('#updateEquipment table').each(function () {
                var obj = {};

                obj.deliverEquipmentId = $(this).find('input[name="deliverEquipmentId"]').val();
                obj.applyLayer = $(this).find('select[name="applyLayer"] option:selected').val();
                obj.applyReason = $(this).find('select[name="applyReason"] option:selected').val();
                obj.equipmentType = $(this).find('input[name="equipmentTypeId"]').val();
                obj.item = $(this).find('input[name="item"]').val();
                obj.itemId = $(this).find('select[name="equipmentItem"] option:selected').val();
                obj.isReturn = $(this).find('select[name="isReturn"] option:selected').val();
                obj.sn = $(this).find('input[name="sn"]').val();
                obj.memo = $(this).find('textarea[name="memo"]').val();
                equipment.push(obj)
                console.log(obj);
                //alert("obj:"+equipment);
                var eqid = obj.deliverEquipmentId
                if (obj.equipmentType == null || obj.equipmentType == '') {
                    $('#' + eqid + 'typeDesErr').show()
                    typeNull = false;
                }

                if (obj.itemId == null || obj.itemId == '') {
                    if (obj.item == null || obj.item == '') {
                        $('#' + eqid + 'itemIdErr').show()
                        itemNull = false;
                    }
                }
            });


            if (typeNull == false) {
                parent.window.tip("请选择备件类型")
                return false;
            }
            if (itemNull == false) {
                parent.window.tip("请填写备件号")
                return false;
            }

            //判断是否需要返件
            var isr = false;
            for (var i = 0; i < equipment.length; i++) {
                console.log("r:" + equipment[i].isReturn);
                if (equipment[i].isReturn == 2) {
                    isr = true;
                }
            }

            if (deliverLogistics == "" || deliverLogistics == "0") {
                $('#deliverLogistics_idErr').show()
                parent.window.tip("请选择发货物流")
                return false;
            }
            if (deliverWarehouse == "" || deliverWarehouse == "0") {
                $('#deliverWarehouseIdErr').show()
                parent.window.tip("请选择仓库")
                return false;
            }
            if (kuwei == "" || kuwei == "0") {
                $('#kuweiErr').show()
                parent.window.tip("请选择库位")
                return false;
            }

            //如果需要返件，返件物流为必填项
            if (isr) {
                if (returnLogistics == null || returnLogistics == '' || returnLogistics == '0') {
                    $('#retrun_logisticsErr').show()
                    parent.window.tip("请选择返件物流")
                    return false;
                }
            } else {
                $('#retrun_logisticsErr').hide()
            }

            //点击发货按钮，校验通过就不可以再次点击发货按钮了
            $('#fhButton').linkbutton('disable');


            var checkboxs = document.getElementsByClassName('equipmentCheck');
            var ids = [];
            for (var i = 0; i < checkboxs.length; i++) {
                var eqId = checkboxs[i];
                if (eqId.checked) {
                    ids.push(eqId.value)
                }

            }
            var eqIds = ids.toString();
            eqIds = decodeURI(eqIds);
            jQuery.messager.confirm('确认信息', '确定要发货吗?', function (event) {
                if (event) {
                    $.ajax({
                        type: "POST",
                        data: {
                            'deliverLogistics_id': deliverLogistics,
                            'fhSLA': fhSLA,
                            'thProvince': thProvince,
                            'thShi': thShi,
                            'thAddress': thAddress,
                            'deliverWarehouse': deliverWarehouse,
                            'kuwei': kuwei,
                            'returnLogistics': returnLogistics,
                            'expectTime': expectTime,
                            'csaAttention': csaAttention,
                            'logisticsMemo': logisticsMemo,
                            'deliverMemo': deliverMemo,
                            'deliverStatus': deliverStatus,
                            'deliverType': deliverType,
                            'deliverid': deliverid,
                            'soCode': soCode,
                            'srCode': srCode,
                            'WlSx': WlSx,
                            'equipment': JSON.stringify(equipment)
                        },
                        url: "cbsDelinerController.do?doUpdate",
                        dataType: "json",
                        success: function (data) {
                            if ($(":checkbox[name=subcheck]:checked").size() != checkboxs.length && $(":checkbox[name=subcheck]:checked").size() != 0) {

                                $.ajax({
                                    type: "POST",
                                    data: {
                                        'deliverid': deliverid,
                                        'ids': eqIds,
                                        'deliverLogistics': deliverLogistics
                                    },
                                    url: "cbsDelinerController.do?sendCF",
                                    dataType: "json",
                                    success: function (data) {
                                        parent.window.tip("发货成功");
                                        //setTimeout("  addOneTab(\"发货管理\",'cbsDelinerController.do?cbsDeliner');",1000);
                                        setTimeout("  addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                                        setTimeout("closetab('" + tabName + "')", 1000);
                                        ;
                                    }
                                })
                            }
                            if ($(":checkbox[name=subcheck]:checked").size() == checkboxs.length) {
                                $.ajax({
                                    type: "POST",
                                    data: {
                                        'deliverid': deliverid,
                                        'ids': eqIds,
                                        'deliverLogistics': deliverLogistics
                                    },
                                    url: "cbsDelinerController.do?sendCFAll",
                                    dataType: "json",
                                    success: function (data) {
                                        parent.window.tip("发货成功");
                                        //setTimeout("  addOneTab(\"发货管理\",'cbsDelinerController.do?cbsDeliner');",1000);
                                        setTimeout("  addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                                        setTimeout("closetab('" + tabName + "')", 1000);
                                    }
                                })
                            }
                        }
                    })
                } else {
                    // alert("你点击的是false");
                    //选择否，发货按钮恢复功能
                    $('#fhButton').linkbutton('enable');
                }
            });
        }


        //标记欠货
        function doQH() {
            //alert("标记欠货");
            var code = $('#code').text();
            var tabName = "编辑" + code;
            var deliverid = $('#deliverId').val();
            var checkboxs = document.getElementsByClassName('equipmentCheck');
            var ids = [];
            for (var i = 0; i < checkboxs.length; i++) {
                var eqId = checkboxs[i];
                if (eqId.checked) {
                    //alert("标记欠货");
                    //alert("value:"+eqId.value);
                    ids.push(eqId.value)

                }
            }
            if (ids.length <= 0) {
                $.messager.alert('提示', '请选择欠货的备件');
            } else {
                $.messager.confirm('确认信息', '确定要标记欠货吗?', function (event) {
                    if (event) {
                        $.ajax({
                            type: "POST",
                            data: {'deliverid': deliverid, 'ids': JSON.stringify(ids)},
                            url: "cbsDelinerController.do?addQH",
                            dataType: "json",
                            success: function (data) {
                                if(data.success){
                                    parent.window.tip("标记成功");
                                    setTimeout("  addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                                    //setTimeout(" window.location.href='cbsDelinerController.do?cbsDeliner'",1000);
                                    setTimeout("closetab('" + tabName + "')", 1000);
                                }else{
                                    tip(data.msg);
                                }

                            }
                        })
                    } else {
                        // alert("你点击的是false");
                    }
                }).panel('move', {})
            }
        }

        function Wlsend() {
            var bjh = $("#bjh").val();
            var sn = $("#sn").val();
            var code = $("#code").val();
            var city = $("#city").text();
            var kw = $("#kw").val();
            var dh = $("#dh").val();
            var weight = $("#weight").val();
            $.ajax({
                type: "post",
                dataType: "json",
                url: "",
                data: {"bjh": bjh, "sn": sn, "code": code, "city": city, "kw": kw, "dh": dh, "weight": weight},
                success: function (data) {

                }
            })
        }

        function delFile(id) {
            var flag = true;
            $.ajax({
                url: "cbsServiceReportController.do?delFile",
                data: {
                    "id": id
                },
                cache: false,
                dataType: 'json',
                type: 'POST',
                async: false,
                success: function (data) {
                    if (!data.success) {
                        flag = false;
                        parent.window.tip(data.msg);
                    } else {
                        parent.window.tip(data.msg);
                        //隐藏标签
                        $("#li_file_" + id + "").remove();
                        $("#repairFrontFile").val("");
                    }
                }
            });
        }
        /**
         * 克隆
            **/
        function copyThisInvoice() {
            var deliverId = $('#deliverId').val();
            //tab名
            var dCode = $('#code').text();
            var tabName = "编辑" + dCode;
            $.ajax({
                type:"post",
                dataType:"json",
                data:{"id":deliverId},
                url:"cbsDelinerController.do?copyThisInvoice",
                success:function (data) {
                    var b = data.success;
                    if(b){
                        tip("克隆成功");
                        setTimeout("addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                        setTimeout("closetab('" + tabName + "')", 1000);
                    }
                }
            })
        }
        /*
        * 取消发货
        * */
        function removeDeliver() {
            var deliverId = $('#deliverId').val();
            var code = $('#code').text();
            var tabName = "编辑" + code;
            var status = $('#status').val();
            //alert("deliverId:"+deliverId);
            if (status == '3' || status == '7') {
                $.messager.alert('警告', '已签收或已取消的发货单不可以执行取消发货!');
            } else {

                $.dialog({
                    content: 'url:cbsDelinerController.do?goCancelDeliver&id=' + deliverId+'&code='+code,
                    lock: true,
                    width: 500,
                    height: 250,
                    title: '取消',
                    opacity: 0.3,
                    cache: false,
                    ok: function () {
                        iframe = this.iframe.contentWindow;
                        iframe.$('#formobj').submit();
                        return false;
                    },
                    cancelVal: '关闭',
                    cancel: true /*为true等价于function(){}*/
                }).zindex();
            }
        }

        function getSLA() {
            var logisticsName = $("#deliverLogistics_id").val();
            var cityId = $("#cityId").val();
            if (logisticsName != "" || logisticsName != null) {
                $.ajax({
                    type: "GET",
                    data: {"logisticsName": logisticsName, "cityId": cityId},
                    url: "cbsDelinerController.do?getSLA",
                    dataType: "json",
                    success: function (data) {
                        var obj = data.obj;
                        if (obj == null) {
                            $("#WlSx").text("无");
                        }
                        if (obj != null) {
                            var slaType = obj.slaType;
                            $("#WlSx").text(slaType);
                        }

                    }
                })
            }
        }

        function getSLAByWarsoue() {
            var logisticsName = $("#deliverLogistics_id").val();
            var cityId = $("#city").val();
            var deliverWarehouseId = $("#deliverWarehouseId").val();
            if (logisticsName != "" || logisticsName != null) {
                $.ajax({
                    type: "GET",
                    data: {"logisticsName": logisticsName, "cityId": cityId, "deliverWarehouseId": deliverWarehouseId},
                    url: "cbsDelinerController.do?getSLAByWarouse",
                    dataType: "json",
                    success: function (data) {
                        var obj = data.obj;
                        if (obj == null) {
                            $("#WlSx").text("无");
                        }
                        if (obj != null) {
                            var slaType = obj.slaType;
                            $("#WlSx").text(slaType);
                        }
                    }
                })
            }
        }

        function checkeNull(obj) {
            var value = obj.value;
            if (value == null || value == '' || value == '0') {
                $('#' + obj.id + 'Err').show();
            } else {
                $('#' + obj.id + 'Err').hide();
            }
        }

        function checkeItemNull(id) {
            var value = $('#' + id + 'in').val();
            if (value == null || value == '' || value == '0') {
                $('#' + id + 'itemIdErr').show();
            } else {
                $('#' + id + 'itemIdErr').hide();
            }
        }

        function hideErr() {
            var value = $('#returnLogistics').val()
            if (value != null && value != '' && value != '0') {
                $('#retrun_logisticsErr').hide()
            }
        }


        function getIsReturn(id){
            var itemId=$('#'+id+'itemId').val()
            if(itemId!=null && itemId!=''){
                $.ajax({
                    type:"GET",
                    data:{"id":itemId},
                    url:"cbsDelinerController.do?getIsReturnByItem",
                    dataType:"json",
                    success:function (data) {
                        var tbs = data.obj;
                        if(tbs.isReturn==1){
                            $('#'+id+'isReturn').val(2)
                        }else{
                            $('#'+id+'isReturn').val(1)
                        }
                    }
                })
            }

        }
        function lookWl(){
            addOneTab('查看物流','http://www.kuaidi100.com/')
        }

        //复制内容到剪切板
        function copyText() {

            var id=$('#copyText').val()
            // alert($('select[id="' + id + '"] option:selected').text())

            var Url2 = $('select[id="' +id + '"] option:selected').text();
            var oInput = document.createElement('input');
            oInput.value = Url2;
            document.body.appendChild(oInput);
            oInput.select(); // 选择对象
            document.execCommand("Copy"); // 执行浏览器复制命令
            oInput.className = 'oInput';
            oInput.style.display = 'none';

            tip("复制成功")

        }

        //自定义右键菜单
        function rightMenu(obj){
            //取消默认的浏览器自带右键 很重要！！
            var e=event || window.event
            e.preventDefault();

            //获取我们自定义的右键菜单
            var menu=document.querySelector("#menu");

            //根据事件对象中鼠标点击的位置，进行定位,加上滚动位置
            var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            var x = e.pageX || e.clientX + scrollX;
            var y = e.pageY || e.clientY + scrollY;
            // alert(x)
            // alert(y)
            menu.style.left=x+'px';
            menu.style.top=y+'px';

            //改变自定义菜单的宽，让它显示出来
            menu.style.width='50px';
            menu.style.height='25px';

            $('#copyText').val(obj.id)
        }
        //关闭右键菜单
        window.onclick=function(e){
            //用户触发click事件就可以关闭了，因为绑定在window上，按事件冒泡处理，不会影响菜单的功能
            document.querySelector('#menu').style.height=0;
        }
        window.oncontextmenu=function(e){
            //用户在自定义右键菜单区域外右键就可以关闭自定义右键菜单了，因为绑定在window上，按事件冒泡处理，不会影响菜单的功能
            console.log(e.defaultPrevented)
            if(!e.defaultPrevented){
                document.querySelector('#menu').style.height=0
            }
        }

    </script>
</head>
<body>
<div style="margin-bottom:10px;">
    <input hidden="hidden" id="deliverId" value="${cbsDelinerPage.id}">
    <img style="margin-bottom:-7px" src="plug-in/login/images/dispatch bill.png">
    <span class="list-title" id="code">${cbsDelinerPage.code}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <span style="font-size:13px;">状态：<span id="deliverStatus" class="color-red">${deliverStatus.typename}</span></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="hidden" value="${cbsDelinerPage.status}" id="status"/>
    <input type="hidden" value="${cbsDelinerPage.logisticsSendTime}" id="logisticsSendTime"/>
    <input type="hidden" id="cityId" value="${cbsDelinerPage.shi.id}"/>
    <input type="hidden" value="${slaType}" id="slaType"/>
    <span>已欠货时长:
			 <span class="color-red">${qhtime}</span>
	 </span>
    <div style="position: absolute; text-align: center; width: 100%; margin-top:-20px;">
		<span <c:if test="${cbsDelinerPage.status!='1'}">hidden="hidden"</c:if>>
			<a class="easyui-linkbutton l-btn" onclick="doUpdate()">保存</a>
		</span>
        <a class="easyui-linkbutton l-btn" onclick="removeDeliver()">取消发货</a>
        <a class="easyui-linkbutton l-btn" onclick="copyThisInvoice()">克隆</a>
        <input type="hidden" id="id" value="${cbsDelinerPage.id}"/>

        <input type="hidden" id="sessionId" value="${pageContext.session.id}">
    </div>
</div>

<div class="subtitle">
    <p>关联信息</p>
    <table class="nobordertable noborder">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>服务单号CR:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.crCode}
            </td>
            <td class="al_r" width="20%">
                <label>服务单类型:</label>
            </td>
            <td width="30%">
                ${servicetype}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>SR:</label>
            </td>
            <td width="30%">
                <input id="SRCode" value="${cbsDelinerPage.srCode}">
            </td>
            <td class="al_r" width="20%">
                <label>SO:</label>
            </td>
            <td width="30%">
                <input id="soCodeId" value="${cbsDelinerPage.soCode}" onkeyup="checkeNull(this)">&emsp;<span id="soCodeIdErr"  hidden="hidden" style="font-size: 10px;color: red"></span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>备件申请单号:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.spaceNumber}
            </td>
           <td class="al_r" width="20%">
                <label>备件申请人:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.equipmentApplyId.createName}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>备件申请备注:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.equipmentApplyId.memo}
            </td>
            <td class="al_r" width="20%">
                <label>发货单类型:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <select id="deliverType" onchange="checkeNull(this)">
                    <c:forEach items="${deliverTypeList}" var="tsType">
                            <option value="${tsType.typecode}" <c:if test="${tsType.typecode == cbsDelinerPage.deliverType}">selected="selected"</c:if> >${tsType.typename}</option>
                    </c:forEach>
                </select>
                &emsp;<span id="deliverTypeErr" onkeyup="checkeNull(this)" hidden="hidden" style="font-size: 10px;color: red">发货单类型不能为空</span>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>发货申请</p>
    <div id="updateEquipment">
        <c:forEach items="${deliverEquipmentList}" var="deliverEquipment">
            <div class="l-div deliverEquipment" id="deliverEquipments">
                <table style="width: 100%">
                    <tr>
                        <td>
                            <input type="checkbox" style="zoom: 200%" name="subcheck" checked="checked"
                                   class="equipmentCheck" value="${deliverEquipment.id}"/>
                        </td>
                        <td>
                            <table class="nobordertable noborder" style="border: 1px;">
                                <input name="deliverEquipmentId" class="deliverEquipmentId" type="hidden"
                                       value="${deliverEquipment.id}">
                                <tbody>
                                <tr>
                                    <td class="al_r" width="20%">
                                        <label>备件类型:<font color="red">*</font></label>
                                    </td>
                                    <td width="30%">
                                        <input name="equipmentTypeId" class="typeDescId" id="${deliverEquipment.id}"
                                               type="hidden" value="${deliverEquipment.typeId.id}"/>
                                        <input class="inputxt" name="equipmentType" readonly="readonly" uuid="*"
                                               type="text" id="${deliverEquipment.id}typeDes"
                                               value="${deliverEquipment.typeDes}"/>
                                        <input class="button" value="选择" type="button"
                                               id="${deliverEquipment.typeId.id}"
                                               onclick="getTree(this,'${deliverEquipment.id}')"/>
                                        <span id="${deliverEquipment.id}typeDesErr" hidden="hidden"
                                              style="color: red;font-size: 10px">备件类型不能为空</span>
                                    </td>
                                    <td class="al_r" width="20%">
                                        <label>备件号:<font color="red">*</font></label>
                                    </td>
                                    <td width="30%">
                                        <%--<c:if test="${empty deliverEquipment.itemId.id}">--%>
                                        <c:if test="${empty equipmentItemMap[deliverEquipment.id]}">
                                            <input type="text" class="equipmentCode" name="item" id="${deliverEquipment.id}in"
                                                   onkeyup="checkeItemNull('${deliverEquipment.id}')"
                                                   value="${deliverEquipment.item}">
                                            <select name="equipmentItem" hidden="hidden"
                                                    id="${deliverEquipment.id}itemId" onchange="checkeNull(this)" oncontextmenu="rightMenu(this)">
                                                <option value="">--请选择备件号--</option>
                                                <c:forEach items="${equipmentItemMap[deliverEquipment.id]}" var="item">
                                                    <c:if test="${item.item==deliverEquipment.item}">
                                                        <option value="${item.id}"
                                                                selected="selected">${item.item}</option>
                                                    </c:if>
                                                    <c:if test="${item.item!=deliverEquipment.item}">
                                                        <option value="${item.id}">${item.item}</option>
                                                    </c:if>
                                                </c:forEach>
                                            </select>
                                            <span id="${deliverEquipment.id}itemIdErr" hidden="hidden"
                                                  style="color: red;font-size: 10px">备件号不能为空</span>
                                        </c:if>
                                        <c:if test="${not empty equipmentItemMap[deliverEquipment.id]}">
                                            <input type="text" hidden="hidden" name="item" class="equipmentCode"
                                                   id="${deliverEquipment.id}in" value=""
                                                   onkeyup="checkeItemNull('${deliverEquipment.id}')">
                                            <select name="equipmentItem" id="${deliverEquipment.id}itemId"
                                                    onchange="checkeNull(this);getIsReturn('${deliverEquipment.id}')" oncontextmenu="rightMenu(this)">
                                                <option value="">--请选择备件号--</option>
                                                <c:forEach items="${equipmentItemMap[deliverEquipment.id]}" var="item">
                                                    <c:if test="${item.item==deliverEquipment.item}">
                                                        <option value="${item.id}"
                                                                selected="selected">${item.item}</option>
                                                    </c:if>
                                                    <c:if test="${item.item!=deliverEquipment.item}">
                                                        <option value="${item.id}">${item.item}</option>
                                                    </c:if>
                                                </c:forEach>
                                            </select>
                                            <span id="${deliverEquipment.id}itemIdErr" hidden="hidden"
                                                  style="color: red;font-size: 10px">备件号不能为空</span>
                                        </c:if>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="al_r" width="20%">
                                        <label>数量:</label>
                                    </td>
                                    <td width="30%">
                                            ${deliverEquipment.total}
                                    </td>
                                    <td class="al_r" width="20%">
                                        <label>申请优先级:</label>
                                    </td>
                                    <td width="30%">
                                        <select name="applyLayer">
                                            <c:forEach items="${applyLayerList}" var="applyLayer">
                                                <c:if test="${applyLayer.typecode==deliverEquipment.applyLayer}">
                                                    <option value="${applyLayer.typecode}"
                                                            selected="selected">${applyLayer.typename}</option>
                                                </c:if>
                                                <c:if test="${applyLayer.typecode!=deliverEquipment.applyLayer}">
                                                    <option value="${applyLayer.typecode}">${applyLayer.typename}</option>
                                                </c:if>
                                            </c:forEach>
                                        </select>

                                    </td>
                                </tr>
                                <tr>
                                    <td class="al_r" width="20%">
                                        <label>是否返件:</label>
                                    </td>
                                    <td width="30%">
                                        <select name="isReturn" id="${deliverEquipment.id}isReturn">
                                            <c:if test="${deliverEquipment.isReturn!='2'}">
                                                <option value="2">是</option>
                                                <option value="1" selected="selected">否</option>
                                            </c:if>
                                            <c:if test="${deliverEquipment.isReturn=='2'}">
                                                <option value="2" selected="selected">是</option>
                                                <option value="1">否</option>
                                            </c:if>
                                        </select>
                                    </td>
                                    <td class="al_r" width="20%">
                                        <label>发货备件序列号:</label>
                                    </td>
                                    <td width="30%">
                                        <input name="sn" value="${deliverEquipment.sn}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="al_r" width="20%">
                                        <label>备件描述:</label>
                                    </td>
                                    <td width="30%">
                                        <textarea name="memo" style="width: 100%; height: 80px;" readonly="readonly"
                                                  maxlength="200"><c:if test="${deliverEquipment.equipmentApplyDetailId.itemDesc !='' and deliverEquipment.equipmentApplyDetailId.itemDesc !=null}">备件描述:${deliverEquipment.equipmentApplyDetailId.itemDesc}。</c:if><c:if test="${deliverEquipment.memo != '' and deliverEquipment.memo != null}">备件说明:${deliverEquipment.memo}</c:if></textarea>
                                    </td>
                                    <td class="al_r" width="20%">
                                        <label>申请理由:</label>
                                    </td>
                                    <td width="30%">
                                        <select name="applyReason">
                                            <c:forEach items="${applyReasonList}" var="applyReason">
                                                <c:if test="${applyReason.typename==deliverEquipment.applyReason}">
                                                    <option selected="selected"
                                                            value="${applyReason.typename}">${applyReason.typename}</option>
                                                </c:if>
                                                <c:if test="${applyReason.typename!=deliverEquipment.applyReason}">
                                                    <option value="${applyReason.typename}">${applyReason.typename}</option>
                                                </c:if>
                                            </c:forEach>
                                        </select>
                                    </td>
                                </tr>
                                					<tr>
						<td class="al_r" width="20%">
							<label>物流发货序列号:</label>
						</td>
						<td width="30%">
						     ${deliverEquipment.deliverSn}
						</td>
						<td class="al_r" width="20%">
							<label>物流发货二维码:</label>
						</td>
						<td width="30%">
								${deliverEquipment.deliverErcode}
						</td>
					</tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        </c:forEach>
    </div>
    <div style="text-align: center;">
        <span <c:if test="${cbsDelinerPage.status==6}">hidden="hidden"</c:if>>
			<a id="fhButton" class="easyui-linkbutton l-btn" onclick="sendCF()">发货</a>
		</span>
        <span <c:if test="${cbsDelinerPage.status==4 || cbsDelinerPage.status==6}">hidden="hidden"</c:if>>
			<a class="easyui-linkbutton l-btn" onclick="doQH()">标记欠货</a>
		</span>
    </div>
    <div style="margin-top:20px; width: 98%; margin: 10px auto;"><span style="font-weight: bold;">说明</span></div>
    <div class="line"></div>
    <table class="nobordertable noborder" style="border: none;margin-left: -40px">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>发货说明:</label>
            </td>
            <td width="30%">
                <textarea id="deliverMemo" style="width: 100%; height: 80px;"
                          maxlength="255">${cbsDelinerPage.deliverDes}</textarea>
            </td>
            <td class="al_r" width="20%">
                <label>CSA注意事项:</label>
            </td>
            <td width="30%">
                <textarea id="csaAttention" style="width: 100%; height: 80px;"
                          readonly="readonly">${cbsDelinerPage.equipmentApplyId.csaAttention}</textarea>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>收货人信息</p>
    <table class="nobordertable noborder" style="border: none;">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>是否自提:</label>
            </td>
            <td width="30%">
				 <span id="isZt">
					 <c:if test="${cbsDelinerPage.zt==1}">
                         是
                     </c:if>
					 <c:if test="${cbsDelinerPage.zt==2}">
                         否
                     </c:if>
				 </span>
            </td>
            <c:if test="${cbsDelinerPage.zt==1}">
                <td class="al_r" width="20%">
                    <label>自提仓库:</label>
                </td>
                <td width="30%">
                        ${cbsDelinerPage.warehouseId.name}
                </td>
            </c:if>
        </tr>
        <tr id="shUser">
            <td class="al_r" width="20%">
                <label>姓名:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.userName}
            </td>
            <td class="al_r" width="20%">
                <label>电话:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.phone}
            </td>
        </tr>
        <tr id="shAddress">
            <td class="al_r" width="20%">
                <label>收货地址:</label>
            </td>
            <td width="30%">
                <input type="hidden" value="${cbsDelinerPage.shi.id}" id="city"/>
                <c:if test="${cbsDelinerPage.sheng !=null}">
                    ${cbsDelinerPage.sheng.territoryName}
                </c:if>
                <c:if test="${cbsDelinerPage.shi !=null}">
                    ${cbsDelinerPage.shi.territoryName}
                </c:if>
                <c:if test="${cbsDelinerPage.address !=null}">
                    ${cbsDelinerPage.address}
                </c:if>
            </td>
            <td class="al_r" width="20%">
                <label>影院名称:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.cinemaName}
            </td>
        </tr>
        <tr id="ztCk" hidden="hidden">
            <td class="al_r"><label>自提仓库:</label></td>
            <td colspan="3">
                <select>
                    <option value="${cbsDelinerPage.warehouseId.sheng.id}">${cbsDelinerPage.warehouseId.sheng.territoryName}</option>
                </select>
                &nbsp;&nbsp;
                <span>${cbsDelinerPage.warehouseId.name}</span>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>物流</p>
    <table class="nobordertable noborder" style="border: none;" id="Wltable">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>发货物流:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <select id="deliverLogistics_id"
                        onchange="getFhContacts();getSLA();getWarehouseByLogistics();checkeNull(this)">
                    <option value="0">--请选择物流--</option>
                    <c:forEach items="${logisticsList}" var="logistics">
                        <c:if test="${cbsDelinerPage.deliverLogistics==logistics.departname}">
                            <option selected="selected" value="${logistics.departname}">${logistics.departname}</option>
                        </c:if>
                        <c:if test="${cbsDelinerPage.deliverLogistics!=logistics.departname}">
                            <option value="${logistics.departname}">${logistics.departname}</option>
                        </c:if>
                    </c:forEach>
                </select>
                &emsp;<span style="color: red" hidden="hidden" id="deliverLogistics_idErr">物流不能为空</span>
                <%--${cbsDelinerPage.deliverLogistics}--%>
            </td>
            <td class="al_r" width="20%">
                <label>联系人:</label>
            </td>
            <td width="30%">
                <label id="contactsName">${zyContacts.name}</label>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>电话:</label>
            </td>
            <td width="30%">
                <label id="contactsPhone">${zyContacts.cellphone1}</label>
            </td>
            <td class="al_r" width="20%">
                <label>邮箱:</label>
            </td>
            <td width="30%">
                <label id="contactsEmail">${zyContacts.email}</label>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>发货SLA:</label>
            </td>
            <td width="30%">
                <t:dictSelect clazz="noSelect" hasPleaseSelect="false" readonly="false" field="status"
                              id="fhSLA" type="select" defaultVal="${cbsDelinerPage.fhSLA}"
                              typeGroupCode="<%=StaticValue.Deliver_SLA %>"/>
            </td>
            <td class="al_r" width="20%">
                <label>物流单号:</label>
            </td>
            <td width="30%">
                ${deliverEquipmentList[0].logisticsNumber}&nbsp;&nbsp;<span class="color-blue" onclick="lookWl()">[查看物流]</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>仓库:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <select id="deliverWarehouseId" onchange="getWarehouseContacts();checkeNull(this);getSLAByWarsoue()">
                    <option value="0">--请选择仓库--</option>
                    <c:forEach items="${wareList}" var="ware">
                        <option <c:if test="${cbsDelinerPage.deliverWarehouseId.id==ware.id}">selected="selected"</c:if>
                                value="${ware.id}">${ware.name}</option>
                    </c:forEach>
                </select>
                &emsp;<span style="color: red" hidden="hidden" id="deliverWarehouseIdErr">仓库不能为空</span>
            </td>
            <td class="al_r" width="20%">
                物流发货附件:
            </td>
            <td width="30%">
                <c:if test="${zyFileLogEntityListSend!=null}">
                    <c:forEach items="${zyFileLogEntityListSend}" var="zyFileLogEntityList">
                        <span onclick="addOneTab('预览','cbsServiceController.do?openViewFile&fileid=${zyFileLogEntityList.id}')"
                              style="color: blue">${zyFileLogEntityList.oldFileName}</span>
                        <span class="color-blue"><a
                                href="fileUploadController.do?downLoadFile&fileLogId=${zyFileLogEntityList.id}">[下载]</a></span>
                    </c:forEach>
                </c:if>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>库位:<font color="red">*</font></label>
            </td>
            <td width="30%">
                <select id="kuwei" onchange="checkeNull(this)">
                    <option value="">--请选择库位--</option>
                    <c:forEach items="${kuweiList}" var="kuwei">
                        <option value="${kuwei.typecode}" <c:if test="${kuwei.typecode==cbsDelinerPage.wLocaltion}">selected="selected"</c:if>>${kuwei.typename}</option>
                    </c:forEach>
                </select>
                <span style="color: red" hidden="hidden" id="kuweiErr">库位不能为空</span>
            </td>
            <td class="al_r" width="20%">
                <label>预计到货时间:</label>
            </td>
            <td width="30%">
                <span id="expectTime" name="expectTime"><fmt:formatDate value="${cbsDelinerPage.expectTime}" type="date"
                                                                        pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></span>
            </td>
        </tr>
        <tr>
            <td class="al_r" valign="top"><label>物流发货备注:</label></td>
            <td colspan="3">
                <textarea id="logisticsMemo"
                          style="width:100%; height: 60px;" readonly="readonly">${cbsDelinerPage.logisticsMemo}</textarea>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>物流提货地址:</label>
            </td>
            <td width="30%">
                <select id="thProvince" onchange="getCity()">
                    <option value="">--请选择省份--</option>
                    <c:forEach items="${shengList}" var="sheng">
                        <option
                                <c:if test="${sheng.id==cbsDelinerPage.thSheng.id}">selected="selected"</c:if>
                                value="${sheng.id}">${sheng.territoryName}</option>
                    </c:forEach>
                </select>
                <select id="thShi">
                    <option value="0">--请选择城市--</option>
                    <c:forEach items="${shiList}" var="shi">
                        <option
                                <c:if test="${shi.id==cbsDelinerPage.thCity.id}">selected="selected"</c:if>
                                value="${shi.id}">${shi.territoryName}</option>
                    </c:forEach>
                </select>
            </td>
            <td class="al_r" width="20%">
                <label>物流承诺时效:</label>
            </td>
            <td width="30%">
                <span id="WlSx">${cbsDelinerPage.wlSLA}</span>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%"></td>
            <td>
                <input id="thAddress" type="text" value="${cbsDelinerPage.thAddress}" style="width: 500px">
                <font color="red">*仅限非物流仓库发货时填写</font>
            </td>

        </tr>
        </tbody>
    </table>

    <table class="nobordertable noborder" style="border: none;">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>返件物流:</label>
            </td>
            <td width="30%">
                <select id="returnLogistics" onchange="getReturnContacts();hideErr()">
                    <option value="">--请选择物流--</option>
                    <c:forEach items="${logisticsList}" var="logistics">
                        <c:if test="${cbsDelinerPage.returnLogistics==logistics.departname}">
                            <option selected="selected" value="${logistics.departname}">${logistics.departname}</option>
                        </c:if>
                        <c:if test="${cbsDelinerPage.returnLogistics!=logistics.departname}">
                            <option value="${logistics.departname}">${logistics.departname}</option>
                        </c:if>
                    </c:forEach>
                </select>
                <span id="retrun_logisticsErr" style="font-size: 10px;color: red" hidden="hidden">请选择返件物流</span>
            </td>
            <td class="al_r" width="20%">
                <label>联系人:</label>
            </td>
            <td width="30%">
                <label id="returnName">${returnContacts.name}</label>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>电话:</label>
            </td>
            <td width="30%">
                <label id="returnPhone">${returnContacts.cellphone1}</label>
            </td>
            <td class="al_r" width="20%">
                <label>邮箱:</label>
            </td>
            <td width="30%">
                <label id="returnEmail">${returnContacts.email}</label>

            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>是否ETA延迟:</label>
            </td>
            <td width="30%">
                <label >
                    <c:if test="${cbsDelinerPage.etaStandard == '1'}">
                        是
                    </c:if>
                    <c:if test="${cbsDelinerPage.etaStandard == '2'}">
                        否
                    </c:if>
                </label>
            </td>
            <td class="al_r" width="20%">
                <label>ETA延迟原因:</label>
            </td>
            <td width="30%">
                <label >${cbsDelinerPage.etaQunqualified}</label>
            </td>

        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>ETA延迟备注:</label>
            </td>
            <td width="30%">
                <label >${cbsDelinerPage.etaNotQualifiedMemo}</label>

            </td>
        </tr>

        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>签收</p>
    <table class="nobordertable noborder" style="border: none;" id="wlSign">
        <tbody>
        <tr>
            <td class="al_r" width="20%">
                <label>签收方式:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.signMethod}
            </td>
            <td class="al_r" width="20%">
                <label>签收时间:</label>
            </td>
            <td width="30%">
                <fmt:formatDate value="${cbsDelinerPage.getTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>物流单照片:</label>
            </td>
            <td width="30%">
                <c:if test="${zyFileLogEntityListSign!=null}">
                    <c:forEach items="${zyFileLogEntityListSign}" var="zyFileLogEntityList">
                        <span onclick="addOneTab('预览','cbsServiceController.do?openViewFile&fileid=${zyFileLogEntityList.id}')"
                              style="color: blue">${zyFileLogEntityList.oldFileName}</span>
                        <span class="color-blue"><a
                                href="fileUploadController.do?downLoadFile&fileLogId=${zyFileLogEntityList.id}">[下载]</a></span>
                    </c:forEach>
                </c:if>
            </td>
            <td class="al_r" width="20%">
                <label>签收备注:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.signMemo}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>是否SLA达标:</label>
            </td>
            <td width="30%">
                <label >
                    <c:if test="${cbsDelinerPage.isStandard == '1'}">
                        是
                    </c:if>
                    <c:if test="${cbsDelinerPage.isStandard == '2'}">
                        否
                    </c:if>
                </label>

            </td>
            <td class="al_r" width="20%">
                <label>是否签收延迟:</label>
            </td>
            <td width="30%">
                <label >
                    <c:if test="${cbsDelinerPage.signStandard == '1'}">
                        否
                    </c:if>
                    <c:if test="${cbsDelinerPage.signStandard == '2'}">
                        是
                    </c:if>
                </label>

            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>签收延迟原因:</label>
            </td>
            <td width="30%">
                <label >${cbsDelinerPage.notQualified}</label>
            </td>
            <td class="al_r" width="20%">
                <label>签收延迟备注:</label>
            </td>
            <td width="30%">
                <label >${cbsDelinerPage.notQualifiedMemo}</label>

            </td>
        </tr>
        </tbody>
    </table>
</div>
<div class="subtitle">
    <p>日志</p>
    <table class="ftable">
        <tbody>
        <tr>
            <th>操作人</th>
            <th>时间</th>
            <th>描述</th>
        </tr>
        <c:forEach items="${logList}" var="log">
            <tr>
                <td>${log.createName}</td>
                <td><fmt:formatDate value="${log.createDate}" type="date"
                                    pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                <td>${log.description}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<div id="menu" style="margin-top: 5px">
    <input hidden="hidden" id="copyText" value="">
    <div class="menu" onclick="copyText()">复制</div>
</div>
</body>
<script src="webpage/com/zybk/com.deli/cbsDeliner.js"></script>